<template>
  <div>
    <van-nav-bar
      title="待发货"
      left-arrow
      @click-left="$router.push('/DeliverGoods')"
    />
    <div class="imformation-top">
      <ul>
        <li>
          <span>客户</span>
          <span>{{ item.cusName }}</span>
        </li>
        <li>
          <span>商品</span>
          <span>{{ item.prodName }}</span>
        </li>
        <li>
          <span>数量</span>
          <span>{{ item.prodNum }}</span>
        </li>
        <li>
          <span>下单人</span>
          <span>{{ item.orderUserName }}</span>
        </li>
        <li>
          <span>下单时间</span>
          <span>{{ item.orderTime }}</span>
        </li>
      </ul>
    </div>

    <div class="imformation-bottom">
      <div>
        <span>收货人</span>
        <input type="text"  v-model="ShouhuoVal" />
      </div>
      <div>
        <span>联系电话</span>
        <input type="text" v-model="phoneVal" />
      </div>
      <div>
        <span>收货地址</span>
        <textarea
          name="TextArea1"
          cols="30"
          rows="5"
          style="
            background: #efefef;
            border: 0;
            padding: 8px;
            border-radius: 3px;
            resize: none;
            color: #999;
          "
          v-model="textareaVal"
        ></textarea>
      </div>
      <div>
        <span>物流单号</span>
        <input type="text" v-model="wlVal" />
      </div>
    </div>

    <button @click="fahuoClick" class="fahuobtn">确认发货信息</button>
  </div>
</template>

<script>
import axios from "axios";
import {sendDelivery} from '../../request/api'
export default {
  data() {
    return {
      item: [],
      serialNo: "",
      ShouhuoVal:"",
      phoneVal:"",
      textareaVal:"",
      wlVal:"",
    };
  },
  created() {
    // console.log(this.$route.query.item);
    this.item = this.$route.query.item;
    this.serialNo = this.item.serialNo;
    // console.log(this.serialNo);
    let token = localStorage.getItem("token");
    axios.get(
      "https://www.ahsj.link/nebula-api/order/v1/orderInfo/"+this.serialNo,
      {
        headers: {
          "x-auth-token": token,
        },
      }
    ).then(res=>{
        // console.log(res);
    });


  },
  methods:{
    fahuoClick(){
    sendDelivery({
        serialNo:this.serialNo,
        receiver:this.ShouhuoVal,
        linkPhone:this.phoneVal,
        address:this.textareaVal,
        logisticsCode:this.wlVal
    }).then(res=>{
        // console.log(res);
    

    })

    this.$router.push('/deliverGoods')
}
  }
};
</script>
 
<style lang = "less" scoped>
/deep/.van-nav-bar {
  background-color: #003399;

  .van-nav-bar__title,
  .van-icon-arrow-left::before {
    color: #fff;
  }
}
.imformation-top {
  margin-top: 10px;
  background-color: #fff;
  width: 100%;
  font-size: 14px;

  ul {
    width: 100%;

    li {
      padding: 20px;
      display: flex;
      justify-content: space-between;
      border-bottom: 1px solid #e5e5e5;

      span {
        &:nth-of-type(2) {
          color: #999;
        }
      }
    }
  }
}

.imformation-bottom {
  background-color: #fff;
  margin-top: 10px;

  div {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    span {
      width: 20%;
    }
    input {
      background-color: #efefef;
      border: 0;
      border-radius: 3px;
      padding: 8px;
      width: 70%;
    }

  
  }

 
}

.fahuobtn{
    width: 90%;
    height: 40px;
    line-height: 40px;
    color: #fff;
    text-align: center;
    background-color: #003399;
    border-radius: 20px;
    border: 0;
    margin: 10px 15px;
}
</style>